home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Almathera Ten Pack 3: CDPD 3
/
Almathera Ten on Ten - Disc 3: CDPD3.iso
/
scope
/
001-025
/
scopedisk16
/
cat
/
cat.doc
< prev
next >
Wrap
Text File
|
1995-03-18
|
3KB
|
76 lines
CAT
File concatenation program.
By: DM Brown
Date: 23 April 1988
This program picks up where the JOIN command and command line
output indirection left off. It does a true file concatenation,
meaning that any files or strings on the command line are
concatenated onto the end of the output file. JOIN always
overwrote the output file, where this program can attach its
output to the end of the file.
The command accepts three different arguments:
-a set the command to append mode (default)
-o set the command to overwrite mode (like JOIN)
-s "string" append "string" onto the end of the file
The usage is as follows:
cat [-a/-o/-s "string"] [file1 [,file2 ...]] [to] file
The optional word 'to' preceding the last file name is optional
and ignored. Any number of arguments can be place on the command
line and mixed any way desired. However, the last argument is
assumed to be the output file name. At the very least, one input
file or a string and the output file are required. The '-a' and
the '-o' options are mutually exclusive and the last one
specified before output has begun will be the one in force during
the rest of the command. After actual output has begun, the '-a'
and '-o' options are read and handled, but have no effect. The
output file is opened as soon as some input is read which can be
written (that is after the first '-s "string"' or file name
argument). In append mode, a file can be concatenated to itself
as well.
I realize that the preceding paragraph might not make a lot of
sense, so I am including an example of it's use. I wrote the
program in frustration of using JOIN and file output indirection.
There was no 'clean' way to concatenate files and strings onto
the end of files without creating a lot of intermediate files
along the way. Of course, it grew beyond what I had initially
intended. I hope someone finds it useful. I included the source
for those who might find it interesting.
Useful (?) example:
; This script will list (dir) all the partitions of my
; hard disk.
date >ram:today
cat -o -s "Hard Disk Listing -- DM Brown" ram:today to
ram:hd_dir
dir >ram:temp dh0: opt a
cat -s "" -s "DH0:" -s "" ram:temp to ram:hd_dir
dir >ram:temp dh1: opt a
cat -s "" -s "DH1:" -s "" ram:temp to ram:hd_dir
dir >ram:temp dh2: opt a
cat -s "" -s "DH2:" -s "" ram:temp to ram:hd_dir
dir >ram:temp dh3: opt a
cat -s "" -s "DH3:" -s "" ram:temp to ram:hd_dir
cp ram:hd_dir t:hd_dir
echo "done."
If anyone wants to contact me about it (I don't think there are
any bugs) I can be reached at GEnie:
DMBROWN